package view
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class AddTxtSprite extends Sprite
	{
		private var content:Sprite;
		private var data:Object
		private var txt:TextSprite;
		public function AddTxtSprite()
		{
			content = new Sprite;
			this.addChild(content);
		}
		public function setData(data:Object):void{
			this.data = data;
			txt = new TextSprite;
			txt.addEventListener(Event.CHANGE,onChange);
			txt.setTxt(data.info);
			content.addChild(txt);
			this.x = data.x;
			this.y = data.y;
		}
		private function onChange(e:Event):void{
			txt.x = -txt.width/2;
			txt.y = -txt.height/2;
		}
	}
}